﻿using GISforTT_API;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows;
using System.Windows.Markup;

using Microsoft.Surface;
using Microsoft.Surface.Presentation;
using Microsoft.Surface.Presentation.Controls;
using Microsoft.Surface.Presentation.Input;


namespace GISforTT_Test
{
    
    
    /// <summary>
    ///This is a test class for MapLayersMangerPanelTest and is intended
    ///to contain all MapLayersMangerPanelTest Unit Tests
    ///</summary>
    [TestClass()]
    public class MapLayersMangerPanelTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for MapLayersMangerPanel Constructor
        ///</summary>
        [TestMethod()]
        public void MapLayersMangerPanelConstructorTest()
        {
            MapLayersMangerPanel target = new MapLayersMangerPanel();

            // Nothing to test for now
        }

        /// <summary>
        ///A test for AddLayerButton_Click
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GISforTT_API.dll")]
        public void AddLayerButton_ClickTest()
        {
            MapLayersMangerPanel_Accessor target = new MapLayersMangerPanel_Accessor();
            SurfaceButton sender = new SurfaceButton();
            RoutedEventArgs e = null;

            int initialNumLayers = MapLayersManager.Instance.MapLayers.Count;

            target.DeleteLayerButton_Click(sender, e);

            // Check that the # of layers in the MapLayerMgr is less by 1
            int finalNumLayers = MapLayersManager.Instance.MapLayers.Count;
            Assert.AreEqual(initialNumLayers + 1, finalNumLayers);
        }

        /// <summary>
        ///A test for Close_Button_Click
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GISforTT_API.dll")]
        public void Close_Button_ClickTest()
        {
            MapLayersMangerPanel_Accessor target = new MapLayersMangerPanel_Accessor();
            object sender = null;
            RoutedEventArgs e = null;
            target.Close_Button_Click(sender, e);
            Assert.AreEqual(target.getVisibility(), Visibility.Hidden);
        }

        /// <summary>
        ///A test for DeleteLayerButton_Click
        ///</summary>
        [TestMethod()]
        [DeploymentItem("GISforTT_API.dll")]
        public void DeleteLayerButton_ClickTest()
        {
            MapLayersMangerPanel_Accessor target = new MapLayersMangerPanel_Accessor();
            SurfaceButton sender = new SurfaceButton();
            RoutedEventArgs e = null;

            int initialNumLayers = MapLayersManager.Instance.MapLayers.Count;

            target.DeleteLayerButton_Click(sender, e);

            // Check that the # of layers in the MapLayerMgr is less by 1
            int finalNumLayers = MapLayersManager.Instance.MapLayers.Count;
            Assert.AreEqual(initialNumLayers - 1, finalNumLayers);
        }

    }
}
